<?php
	
	include 'database.php';
			
	if($_POST['delete'])
	{
		$k_id = $_POST['k_id'];
		$countK_id = count($_POST['k_id']);
		$rol_update = $_POST['rollen'];			
		
		for($i=0;$i<$countK_id;$i++){
		
			$upd_id = $k_id[$i];
			$upd_rol = $rol_update[$i];
			
			$sql1 = "UPDATE members SET niveau_id =(SELECT id FROM niveau WHERE rol = '$upd_rol') WHERE id = '$upd_id' ";
			mysqli_query($dbcon, $sql1) or die('Foutje...');		
		
		}			
		
		if(isset($_POST['checkbox'])){
		
			$checkbox = $_POST['checkbox']; 
			$countCheck = count($_POST['checkbox']);
			
			for($i=0;$i<$countCheck;$i++)
			{
				$del_id  = $checkbox[$i];
				
				$sql = "DELETE FROM gegevens WHERE klantid = '$del_id'";
				$result = mysqli_query($dbcon, $sql) or die('NEE');
				
			}
		}
		else{}	
			
		
		
		
		header('location: back_end_gegevens.php');	
			
			
	}	

	
	
	
	
?>